package com.maezia.tdr.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
public enum RedisMessageEnum {
    LOGGING_POCESSING_SERVICE("loggingPocessingServiceImpl", "接口日志访问记录"),
    REPORT_POCESSING_SERVICE("reportPocessingServiceImpl", "组装试驾数据");

    private String name;
    private String message;
    private static Map<String, RedisMessageEnum> REDIS_MESSAGE_ENUM_MAP;

    static {
        REDIS_MESSAGE_ENUM_MAP = Arrays.stream(RedisMessageEnum.values())
                .collect(Collectors.toMap(RedisMessageEnum::getName, RedisMessageEnum -> RedisMessageEnum));
    }

    RedisMessageEnum(String name, String message){
        this.name = name;
        this.message = message;
    }

    public static RedisMessageEnum getRedisMessageEnum(String topic){
        return REDIS_MESSAGE_ENUM_MAP.get(topic);
    }
}
